package com.infowarelab.groovytest.impl

import groovy.mock.interceptor.MockFor
import com.infowarelab.groovytest.impl.ReadServiceImpl
import com.infowarelab.groovytest.ReadService
import com.infowarelab.groovytest.ContentService

class TestRead extends GroovyTestCase {

	void setUp(){
		println "start TestRead"
	}

	void testRead() {
		def mock = new MockFor(ContentServiceImpl)
		mock.demand.getContent(){"Kevin"}

		mock.use{
			def contentService = new ContentServiceImpl()
		    def reader = new ReadServiceImpl()
			reader.setContentService(contentService)
			assertEquals reader.readContent() , "hello Kevin"
		}
	}
}


class ContentServiceImpl implements ContentService{
	String getContent(){}
}